package com.ysu.zyw.service;

import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by zhang_yao_wu1993 on 15/4/25.
 *
 * @author by Zerur
 */
@Service("blogPromptService")
public class BlogPromptService {
    public void fillKnownExceptionPromptModelAndView(ModelAndView modelAndView, Exception e) {
        modelAndView.addObject("LineOne", "Sorry");
        modelAndView.addObject("LineTwo", e.getMessage());
    }

    public void fillUnknownExceptionPromptModelAndView(ModelAndView modelAndView) {
        modelAndView.addObject("LineOne", "Sorry");
        modelAndView.addObject("LineTwo", "发生了未知错误");
    }

    public void fillSuccessPromptModelAndView(ModelAndView modelAndView) {
        modelAndView.addObject("LineOne", "Congratulations");
        modelAndView.addObject("LineTwo", "操作成功");
    }

    public void fillFailedPromptModelAndView(ModelAndView modelAndView) {
        modelAndView.addObject("LineOne", "Sorry");
        modelAndView.addObject("LineTwo", "操作失败");
    }

    public void fillInsufficientPermissionsModelAndView(ModelAndView modelAndView) {
        modelAndView.addObject("LineOne", "Sorry");
        modelAndView.addObject("LineTwo", "您没有权限");
    }

    public void fillPageNotFoundModelAndView(ModelAndView modelAndView) {
        modelAndView.addObject("LineOne", "Sorry");
        modelAndView.addObject("LineTwo", "访问的页面不存在");
    }
}
